package Logica;

import DAO.SupplieDao;
import DAO.TreatmentDao;

import java.sql.Date;

import java.util.ArrayList;

public class Supplies {
  //Primary Key
  private int numberS;
  //Attributes
  private String tipoS;
  private String nameS;
  private String descripcion;
  private int cantidad;
  private int reorderl;
  private int reorderq;
  private float cost;
  private ArrayList<Supplies> reemplazo = new ArrayList<Supplies>();
  // Deben ser: clinic pharmaceutical supplies
  SupplieDao sd = new SupplieDao();

  public Supplies() {
  }

  public Supplies(String tipoS, String nameS, String descripcion, int cantidad,
                  int reorderl, int reorderq, float cost, int numberS,
                  ArrayList<Supplies> reemplazo) {
    super();
    this.tipoS = tipoS;
    this.nameS = nameS;
    this.descripcion = descripcion;
    this.cantidad = cantidad;
    this.reorderl = reorderl;
    this.reorderq = reorderq;
    this.cost = cost;
    this.numberS = numberS;
    this.reemplazo = reemplazo;
  }

  public void setTipoS(String tipoS) {
    this.tipoS = tipoS;
  }

  public String getTipoS() {
    return tipoS;
  }

  public void setNameS(String nameS) {
    this.nameS = nameS;
  }

  public String getNameS() {
    return nameS;
  }

  public void setDescripcion(String descripcion) {
    this.descripcion = descripcion;
  }

  public String getDescripcion() {
    return descripcion;
  }

  public void setCantidad(int cantidad) {
    this.cantidad = cantidad;
  }

  public int getCantidad() {
    return cantidad;
  }

  public void setReorderl(int reorderl) {
    this.reorderl = reorderl;
  }

  public int getReorderl() {
    return reorderl;
  }

  public void setReorderq(int reorderq) {
    this.reorderq = reorderq;
  }

  public int getReorderq() {
    return reorderq;
  }

  public void setCost(float cost) {
    this.cost = cost;
  }

  public float getCost() {
    return cost;
  }

  public void setNumberS(int numberS) {
    this.numberS = numberS;
  }

  public int getNumberS() {
    return numberS;
  }

  public void setReemplazo(ArrayList<Supplies> reemplazo) {
    this.reemplazo = reemplazo;
  }

  public ArrayList<Supplies> getReemplazo() {
    return reemplazo;
  }

  public Object[][] DarDatosSupplies() {
    Object[][] datos = new Object[100][100];
    datos = sd.DatosSupplieTabla();

    return datos;
  }

  public void modificaSupplieCantidad(String nuevoCant, String NumSupplie) {
    int NumSupplie1 = Integer.valueOf(NumSupplie);
    System.out.println(NumSupplie);
    int canti = Integer.valueOf(nuevoCant);
    sd.modificaSupplieQuantity(NumSupplie1, canti);
  }

  public void modificaSupplieCost(String NumSup, String cost) {
    int numtreatment = Integer.valueOf(NumSup);
    float cost1 = Float.valueOf(cost);
    sd.modificaSupplieCost(numtreatment, cost1);
  }

  public void modificaSupplieDes(String NumSup, String des) {
      System.out.println("NUmSup: " + NumSup);
    int NumSup1 = Integer.valueOf(NumSup);
    sd.modificaSupplieDescription(NumSup1, des);
  }

  public void modificaSupName(String NumSup, String name) {
    int NumSup1 = Integer.getInteger(NumSup);
    sd.modificaSupplieName(NumSup1, name);
  }
  
  public void modificaSupTipo(String NumSup, String tipo) {
    int NumSup1 = Integer.valueOf(NumSup);
    sd.modificaSupplieName(NumSup1, tipo);
  }

  public void modificaNoClinic(String NumSup, String NoClinic) {
    int NumSup1 = Integer.valueOf(NumSup);
    int Nocli=Integer.valueOf(NoClinic);
    sd.modificaSupplieClinic(NumSup1, Nocli);
  }

  public void modificaReorderLevel(String NumSup, String reorder) {
    int NumSup1 = Integer.getInteger(NumSup);
    int reorder1 = Integer.valueOf(reorder);
    sd.modificaSupplieReorderLvl(NumSup1, reorder1);
  }

  public void modificaReorderCan(String reordecan, String NumSup) {
    int NumSup1 = Integer.valueOf(NumSup);
    int reorder = Integer.valueOf(reordecan);
    sd.modificaSupplieReorderQuan(NumSup1, reorder);
  }

  public void modificaReplacement(String replace, String NumSup) {
    int NumSup1 = Integer.valueOf(NumSup);
    int replace1 = Integer.valueOf(replace);
    sd.modificaSupplieReplacement(NumSup1, replace1);

  }


  public boolean creaSupplie (String ClinicNum,String tipoS, String nameS,
                             String descripcion, String cantidad,
                             String reorderl, String reorderq, String cost) {
    System.out.println("Cantididad: " + cantidad);
    int cant = Integer.valueOf(cantidad);
    int reorderlevel = Integer.valueOf(reorderl);
    int reordecan = Integer.valueOf(reorderq);
    float costo = Float.valueOf(cost);
    int ClinicNum1=Integer.valueOf(ClinicNum);
    return sd.creaSupplie(ClinicNum1,tipoS, nameS, descripcion, cant, reorderlevel,
                          reordecan, costo);

  }

  public boolean EliminarSupp(String NumSup) {
    return sd.eliminarSupplie(Integer.valueOf(NumSup));
  }
}
